#ifndef WAVEFILE_H

#define WAVEFILE_H

#include <fstream.h>

class CWaveFile: private fstream
	{
public: // Konstanten
	enum {OK=0, OpenError=-1, FormatError=-2, WriteErr=-3} ;

private:
	bool High;
	bool isStereo;
	long Freq;
	long nSamples;
	long Pos;
	bool Write;

public:
	CWaveFile();
	~CWaveFile();

	// zum Lesen: 
	int Open(const char *FileName);
	long Samples() { return isStereo ? nSamples / 2 : nSamples; } 
	long SampleFreq() { return Freq; }
	bool Stereo() { return isStereo; }
	int Bits() { return High ? 16 : 8; }
	int GetSample(); // bei Stereo nacheinander Links und Rechts
	
	// zum Schreiben
	int Create(const char *FileName, long SampleFreq, bool Stereo, int Bits, long Samples);
	int PutSample(int x); // bei Stereo nacheinander Links und Rechts

	int Close();

	} ;


#endif // WAVEFILE_H







